From 5d80e4b65c64d6c6efd396faee3debd3612a30c8 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 23 Jan 2006 20:00:02 +0000 Subject: [PATCH] Fix misalignment of RTL text in ellipsized GtkLabel: use layout width if 2006-01-23 Behdad Esfahbod * gtk/gtklabel.c (get_layout_location): Fix misalignment of RTL text in ellipsized GtkLabel: use layout width if set, otherwise fallback to ink extents width. (#322042) --- ChangeLog | 6 ++++++ ChangeLog.pre-2-10 | 6 ++++++ gtk/gtklabel.c | 14 +++++++++++--- tests/.cvsignore | 2 ++ 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index f9660a2742..71ece708ef 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-01-23 Behdad Esfahbod + + * gtk/gtklabel.c (get_layout_location): Fix misalignment of RTL + text in ellipsized GtkLabel: use layout width if set, otherwise + fallback to ink extents width. (#322042) + 2006-01-23 Matthias Clasen * gtk/gtkassistant.c (compute_last_button_state): Only show the diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index f9660a2742..71ece708ef 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,9 @@ +2006-01-23 Behdad Esfahbod + + * gtk/gtklabel.c (get_layout_location): Fix misalignment of RTL + text in ellipsized GtkLabel: use layout width if set, otherwise + fallback to ink extents width. (#322042) + 2006-01-23 Matthias Clasen * gtk/gtkassistant.c (compute_last_button_state): Only show the diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c index 28cc24e810..79c5be1c48 100644 --- a/gtk/gtklabel.c +++ b/gtk/gtklabel.c @@ -2220,11 +2220,19 @@ get_layout_location (GtkLabel *label, if (label->ellipsize || priv->width_chars > 0) { + int width; PangoRectangle ink_rect; - pango_layout_get_extents (label->layout, &ink_rect, NULL); - - req_width = PANGO_PIXELS (ink_rect.width); + width = pango_layout_get_width (label->layout); + if (width == -1) + { + pango_layout_get_extents (label->layout, &ink_rect, NULL); + req_width = PANGO_PIXELS (ink_rect.width); + } + else + { + req_width = PANGO_PIXELS (width); + } } else req_width = widget->requisition.width; diff --git a/tests/.cvsignore b/tests/.cvsignore index 8ac714c1f7..cc80c1b81f 100644 --- a/tests/.cvsignore +++ b/tests/.cvsignore @@ -14,8 +14,10 @@ pixbuf-read pixbuf-threads simple stresstest-toolbar +floatingtest testactions testaccel +testassistang testcairo testcalendar testcellrenderertext -- 2.30.2